home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / axxwar_1.zip / SOURCES / LASERSIG.QC < prev    next >
Text File  |  1997-03-04  |  4KB  |  135 lines

  1. // AxxWars 0.8
  2.  
  3. /*
  4. ==============
  5. SightThink
  6. ==============
  7. */
  8. void () SightThink =
  9. {
  10.     local vector org;
  11.     local vector src;
  12.     local entity me;    
  13.     local float temp;    
  14.     
  15.     me=self.owner;    
  16.       makevectors(me.v_angle);
  17.     org = me.origin + v_up*16;
  18.         traceline (org, org + v_forward*2048, FALSE, self);
  19.  
  20.     setorigin(self,trace_endpos-v_forward*10);
  21.     self.nextthink=time+0.1;
  22.  
  23.     // check if target is damageable and set proper model
  24.     if (trace_ent.takedamage)
  25.         setmodel (self, "progs/cross2.mdl");
  26.     else
  27.         setmodel (self, "progs/cross1.mdl");
  28.  
  29.     if(( me.ID_ent != trace_ent) || (time > me.ID_time))
  30.         {
  31.         if( (trace_ent.classname == "player") || (trace_ent.classname == "cbot"))
  32.             {
  33.                 if(trace_ent.team!=me.team) 
  34.                     sprint(me,"FOE: ");
  35.                 else sprint(me,"FRIEND: ");
  36.             sprint(me,trace_ent.netname);
  37.             temp=trace_ent.weapon;
  38.             if(temp==IT_AXE) 
  39.                 sprint(me,"- Axe");
  40.             else if(temp==IT_SNIPER) 
  41.                 sprint(me,"- Sniper");
  42.             else if(temp==IT_SUPER_SHOTGUN) 
  43.                 sprint(me,"- Super Shotgun");
  44.             else if(temp==IT_NAILGUN) 
  45.                 sprint(me,"- Nailgun");
  46.             else if(temp==IT_SUPER_NAILGUN) 
  47.                 sprint(me,"- Super Nailgun");
  48.             else if(temp==IT_GRENADE_LAUNCHER) 
  49.                 sprint(me,"- Grenade Launcher");
  50.             else if(temp==IT_ROCKET_LAUNCHER) 
  51.                 sprint(me,"- Rocket Launcher");
  52.             else if(temp==IT_LIGHTNING) 
  53.                 sprint(me,"- Lightning Gun");
  54.             else 
  55.                 sprint(me,"- Unknown Weapon");
  56.             }
  57.         else if( !me.deadflag && trace_ent.flags & FL_MONSTER)
  58.             {
  59.             sprint(me,"ID: ");
  60.             if(trace_ent.classname=="monster_ogre") sprint(me,"Ogre (Chainsaw/grenades)");
  61.             else if(trace_ent.classname=="monster_knight") sprint(me,"Knight (Sword)");
  62.             else if(trace_ent.classname=="monster_shambler") sprint(me,"Shambler (Claws/lightning bolt)");
  63.             else if(trace_ent.classname=="monster_demon1") sprint(me,"Fiend (Claw/horn)");
  64.             else if(trace_ent.classname=="monster_wizard") sprint(me,"Scrag (Particle beam)");
  65.             else if(trace_ent.classname=="monster_zombie") sprint(me,"Zombie (Chunk 'o flesh)");
  66.             else if(trace_ent.classname=="monster_dog") sprint(me,"Rottweiler (Tooth/claw)");
  67.             else if(trace_ent.classname=="monster_hell_knight") sprint(me,"Death Knight (Sword/flame fan)");
  68.             else if(trace_ent.classname=="monster_tarbaby") sprint(me,"Spawn (Corrosive touch)");
  69.             else if(trace_ent.classname=="monster_vomit") sprint(me,"Vore (Firepod)");
  70.             else if(trace_ent.classname=="monster_enforcer") sprint(me,"Enforcer (Laser rifle)");
  71.             else if(trace_ent.classname=="monster_army") sprint(me,"Grunt (Shotgun)");
  72.             else sprint(me,trace_ent.classname);}
  73.         else return;
  74.         sprint(me,"\n");
  75.         me.ID_time=time+3;
  76.         me.ID_ent=trace_ent;}
  77.  
  78.     
  79.     // move sight at line of sight collision
  80.     self.angles = vectoangles(v_forward);
  81.         setorigin(self, trace_endpos );
  82.  
  83.     // mark think to update sight position
  84.     self.nextthink = time + 0.05;
  85. };
  86.  
  87. /*
  88. =============
  89. SightMake
  90. =============
  91. */
  92.  
  93. void ()    SightMake =
  94. {
  95.     local entity cross;
  96.  
  97.         self.sight_out = TRUE;
  98.  
  99.     cross = spawn ();
  100.     cross.owner = self;
  101.     cross.movetype = MOVETYPE_NOCLIP;
  102.     cross.solid = SOLID_NOT;
  103.  
  104.     setmodel (cross, "progs/cross1.mdl");
  105.     cross.classname = "laser_sight";
  106.  
  107.     setorigin( cross, self.origin );
  108.  
  109.     cross.think = SightThink;
  110.     cross.nextthink = time + 0.05;
  111. };
  112.  
  113. /*
  114. =============
  115. SightOff
  116. =============
  117. */
  118. void ()     SightOff =
  119. {
  120.             local entity e;        // AXXLS
  121.     
  122.  
  123.             e = find( world, classname, "laser_sight");
  124.             while (e)
  125.                 {    
  126.                 if (e.classname == "laser_sight" && e.owner == self)
  127.                     {    
  128.                     remove(e);
  129.                     return;    
  130.                     }
  131.                 e = nextent(e);    
  132.             }    
  133. };
  134.  
  135.